﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using MONTRASEC_test.Classes;

namespace MONTRASEC_test.Controls
{
  public partial class wucTemplateHelperTopButtonsGL : System.Web.UI.UserControl
  {

    public Button createNewRecordButton
    {
      get
      {
        return buCreateNewRecord;
      }
      set
      {
        buCreateNewRecord = value;
      }

    }
    public Button refreshPageButton
    {
      get
      {
        return buRefreshPage;
      }
      set
      {
        buRefreshPage = value;
      }
    }
    public Button ExportExcelButton
    {
      get
      {
        return btnExportGrid;
      }
      set
      {
        btnExportGrid = value;
      }
    }
    //protected void Page_Load(object sender, EventArgs e)
    //{

    //}

    protected void buCreateNewRecord_Click(object sender, EventArgs e)
    {
      //Session["CurrentANewEntryID"] = this.gvANewEntry.SelectedValue; //dvANewEntry.DataKey.Value

      // notify the subscribers
      onCreateNewRecord_Clicked(e);
    }


    // the delegate; a delegate is a reference type used to encapsulate a method with a specific signature and return type.* You can encapsulate any matching method in that delegate.
    public delegate void buCreateNewRecord_ClickHandler(object sender, EventArgs e);

    // an instance of the delegate
    public event buCreateNewRecord_ClickHandler CreateNewRecord_Clicked;

    protected virtual void onCreateNewRecord_Clicked(EventArgs e)
    {
      if (CreateNewRecord_Clicked != null)
      {
        CreateNewRecord_Clicked(this, e);
      }
    }
    protected void BtnExportGrid_Click(object sender, EventArgs e)
    {
      onExportExcel_Clicked(e);
    }




    protected void buRefreshGV(object sender, EventArgs e)
    {
      //link to the current detailsview
      //dvANewEntry.ChangeMode(DetailsViewMode.ReadOnly);
      Response.Redirect(Request.Url.LocalPath);
    }




    // the delegate; a delegate is a reference type used to encapsulate a method with a specific signature and return type.* You can encapsulate any matching method in that delegate.
    public delegate void buExportExcel_ClickHandler(object sender, EventArgs e);

    // an instance of the delegate
    public event buExportExcel_ClickHandler ExportExcel_Clicked;

    protected virtual void onExportExcel_Clicked(EventArgs e)
    {
      if (ExportExcel_Clicked != null)
      {
        ExportExcel_Clicked(this, e);
      }
    }


    // the delegate; a delegate is a reference type used to encapsulate a method with a specific signature and return type.* You can encapsulate any matching method in that delegate.
    public delegate void buCreateNewComment_ClickHandler(object sender, EventArgs e);

    // an instance of the delegate
    public event buCreateNewComment_ClickHandler CreateNewComment_Clicked;

    protected virtual void onCreateNewComment_Clicked(EventArgs e)
    {
      if (CreateNewComment_Clicked != null)
      {
        CreateNewComment_Clicked(this, e);
      }
    }

    protected void buCreateNewComment_Click(object sender, EventArgs e)
    {

      ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", "window.open( '../GL_NFP_EU/UserComments.aspx', null, 'height=600,width=800,resizable=yes,status=yes,titlebar=no,toolbar=no,menubar=no,location=no' );", true);

    }

    protected void buGenerateExcel_Click(object sender, EventArgs e)
    {

      ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", "window.open( 'ShowAllNewEntry.aspx', null, null );", true);

    }

  }
}